
//认购份数
$('.total-amount').html($('.bench').html());
$('.addition').click(function(){
    var bench = $('.bench').html();
    var copies = Number($('.copies-number').val())+1;
    $('.copies-number').val(copies);
    $('.total-amount').html(copies*bench);
})
$('.subtraction').click(function(){
    var bench = $('.bench').html();
    var copies = Number($('.copies-number').val())-1;
    if(copies>-1){
        $('.copies-number').val(copies);
        $('.total-amount').html(copies*bench);
    }else{
        $('.copies-number').val('0');
        $('.total-amount').html('0');
    }
})

var id = window.location.pathname.split('/')[2];
    $.ajax({
   url:"/detail/"+id+".json",
   type:"get",
    dataType:"json",
   success:function(data){
    console.log(data.model.remainDay.split('-')[0]);
    console.log(data);

        $('.remain').html(data.model.remainDay.split('-')[0]);

    },
    error: function(msg) {
        console.log(msg)
    }
})